package 面向对象编程基础.贷款系统;

import java.util.Scanner;

public class LoanTest {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入贷款年利率: ");
        double rate = scanner.nextDouble();
        System.out.print("请输入贷款年限(年): ");
        int year = scanner.nextInt();
        System.out.print("请输入贷款总额(元): ");
        double money = scanner.nextDouble();
        Loan loan = new Loan(rate, year, money);
        System.out.println("等额本息情况下的月均还款额为: "+loan.getMonthlyPayment()+"元");
        System.out.println("贷款"+year+"年利率为"+rate+"%，总额为"+money+"元，等额本息情况下的还款总额为"+loan.getTotalPayment()+"元");
    }
}
